Skip to content

fix(firmware): include factory MAC in WS avatar URL query#29

Open
Flo5k5 wants to merge 1 commit intom5stack:mainfrom
Flo5k5:fix/firmware-ws-mac-query
Open

fix(firmware): include factory MAC in WS avatar URL query#29
Flo5k5 wants to merge 1 commit intom5stack:mainfrom
Flo5k5:fix/firmware-ws-mac-query

Conversation

@Flo5k5
Copy link
Copy Markdown

@Flo5k5 Flo5k5 commented Apr 22, 2026

The server's web_socket.Handler rejects connections without both
'mac' and 'deviceType' query parameters (server/internal/web_socket/
web_socket.go:89-92):

mac := r.Get(\"mac\").String()
deviceType := r.Get(\"deviceType\").String()
if mac == \"\" || deviceType == \"\" {
    r.Response.Write(\"The mac and deviceType parameters are empty.\")
    return
}

Before this change, hal_ws_avatar built the URL with only
?deviceType=StackChan, so every WebSocket handshake was silently
rejected. Observable on-device as endless 'WS-Avatar: Failed to
connect' retries; observable server-side as a TCP connection that
upgrades, receives the upgrade request, and is abandoned without a
WS upgrade.

Read the factory MAC at init() and inject it in the URL, matching
the format the iOS app already uses:
?mac=441BF6E48694&deviceType=StackChan

The server's web_socket.Handler rejects connections without both
'mac' and 'deviceType' query parameters (server/internal/web_socket/
web_socket.go:89-92):

    mac := r.Get(\"mac\").String()
    deviceType := r.Get(\"deviceType\").String()
    if mac == \"\" || deviceType == \"\" {
        r.Response.Write(\"The mac and deviceType parameters are empty.\")
        return
    }

Before this change, hal_ws_avatar built the URL with only
?deviceType=StackChan, so every WebSocket handshake was silently
rejected. Observable on-device as endless 'WS-Avatar: Failed to
connect' retries; observable server-side as a TCP connection that
upgrades, receives the upgrade request, and is abandoned without a
WS upgrade.

Read the factory MAC at init() and inject it in the URL, matching
the format the iOS app already uses:
  ?mac=441BF6E48694&deviceType=StackChan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant